#ifndef HITHREAD_H
#define HITHREAD_H

#include <pthread.h>

class HiThread
{
protected:
    pthread_attr_t      tattr_;
    pthread_mutex_t     lock_;
    pthread_t           thread_;
    volatile bool       running_;
    volatile bool       stop_;
private:
    static void *run(void *arg);
    char thread_name_[32];
public:
    HiThread();
    virtual ~HiThread();
    bool start(char* threadname);
    virtual void process() = 0;
    bool running();
    pthread_t thread_handle();
    bool stop_thread();
};

#endif // HITHREAD_H
